/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Random;
import java.util.stream.IntStream;

/**
 * <p>Project: jse2303 - Stream3</p>
 * <p>Powered by webrx On 2023-07-25 15:39:08</p>
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream4 {
    public static void main(String[] args) {
        Random rand = new Random();
        IntStream is = IntStream.generate(() -> rand.nextInt(1, 10000000)).limit(10000000);

        long ss = System.currentTimeMillis();
        is.parallel().sorted().forEachOrdered(e -> System.out.print(e + " "));
        //is.sorted().forEach(e -> System.out.print(e + " "));
        long ee = System.currentTimeMillis();
        System.out.println();
        System.out.println(Thread.activeCount());

        System.out.println(ee - ss);

        //System.out.println(is.distinct().count());

        //is.forEach(System.out::println);

        //System.out.println(is);


    }
}
